package cn.itsource.web;

import cn.itsource.domain.User;
import cn.itsource.feignclient.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
@RefreshScope // 自动刷新
public class OrderController {

    @Autowired
    private UserFeignClient userFeignClient;

    @Value("${temptest.test}")
    private String test;

    @GetMapping("/{id}")
    public User getUser(@PathVariable("id") Long id){
        System.out.println("test: "+ test);
        return userFeignClient.getUser(id);

    }
}
